﻿using FireStarterModeller.BO;
using Habanero.Testability;

namespace FireStarterModeller.Test.BO
{
    public class TestUtilsUIGridFilterProp
    {
        public static BOTestFactory<UIGridFilterProp> GetFactory()
        {
            return BOTestFactoryRegistry.Instance.Resolve<UIGridFilterProp>();
        }
        /// <summary>
        /// Creates a new saved UIGridFilterProp with a random value assigned to every property
        /// </summary>
        public static UIGridFilterProp CreateSavedUIGridFilterProp()
        {
            UIGridFilterProp uIGridFilterProp = CreateUnsavedValidUIGridFilterProp();
            uIGridFilterProp.Save();
            return uIGridFilterProp;
        }

        /// <summary>
        /// Creates a new unsaved UIGridFilterProp with a random value assigned to every property
        /// </summary>
        public static UIGridFilterProp CreateUnsavedValidUIGridFilterProp()
        {
            UIGridFilterProp uIGridFilterProp = new UIGridFilterProp();
            uIGridFilterProp.UIGridFilter = TestUtilsUIGridFilter.CreateSavedUIGridFilter();
            uIGridFilterProp.PropertyName = TestUtilsDMProperty.CreateSavedDMProperty().PropertyName;
            uIGridFilterProp.Generated = TestUtilsShared.GetRandomBoolean();
            uIGridFilterProp.UIGridFilterType = TestUtilsUITypeDefinition.CreateSavedUITypeDefinition();
            uIGridFilterProp.LabelText = TestUtilsShared.GetRandomString();
            uIGridFilterProp.DefaultValue = TestUtilsShared.GetRandomString();
            uIGridFilterProp.Nullable = TestUtilsShared.GetRandomBoolean();
            uIGridFilterProp.OrdinalPosition = TestUtilsShared.GetRandomInt();
//			uIGridFilterProp.IncludeStartDate = TestUtilsShared.GetRandomBoolean();
//			uIGridFilterProp.IncludeEndDate = TestUtilsShared.GetRandomBoolean();
            uIGridFilterProp.FilterClauseOp = null;
            return uIGridFilterProp;
        }
	    
        /// <summary>
        /// Creates a new unsaved UIGridFilterProp where all properties are null, except ID properties
        /// and those with default values.  If there are compulsory properties without
        /// defaults, saving the object will throw an exception.
        /// </summary>
        public static UIGridFilterProp CreateUnsavedDefaultUIGridFilterProp()
        {
            UIGridFilterProp uIGridFilterProp = new UIGridFilterProp();
            return uIGridFilterProp;
        }
    }
}